package com.sw.code4j.common;

import com.gwssi.fusion.datamodel.common.ConnTypeEnum;

/**
 * @author: 张上亚 2021/10/28 15:42
 * @desc: java字段类型
 */
public enum JavaTypeEnum {

    STRING("String","字符串"),
    NUMBER("BigDecimal", "数值"),
    TIME("Calendar", "时间");

    private String name;
    private String code;

    JavaTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    public static ConnTypeEnum parse(String code) {
        if(code==null){
            return null;
        }
        for (ConnTypeEnum channelType : ConnTypeEnum.values()) {
            if (channelType.getCode().equals(code)) {
                return channelType;
            }
        }
        return null;
    }
}
